import React, { Component } from 'react'
// 8.组件引入状态管理器
import store from './store'
export default class List2 extends Component {
  render() {
    return (
      <div>
        list2
        <button onClick={ () => {
          // 9.改变状态
          store.dispatch({
            type: 'CHANGE_LIST',
            payload: [7, 8, 9]
          })
        } }>改变list的值</button>
        {
          store.getState().list.map((item, index) => {
            return (
            <div key={index}>{ item }</div>
            )
          })
        }
      </div>
    )
  }
}
